<template>
	<view class="member">
		<!-- <header-box :title="pageTitle"></header-box> -->
		
		<view class="member-main">
			<view class="member-main-grade">
				<image class="member-main-grade-img" v-if="userInfo.level == 1" src="../../static/img/lv1-icon.png" mode=""></image>
				<image class="member-main-grade-img" v-if="userInfo.level == 2" src="../../static/img/lv2-icon.png" mode=""></image>
				<image class="member-main-grade-img" v-if="userInfo.level == 3" src="../../static/img/lv3-icon.png" mode=""></image>
				<view class="member-main-grade-txt"><text>{{userInfo.level === 1?'等级一':userInfo.level == 2?'等级二':'等级三'}}</text></view>
			</view>
			<view class="member-main-mony">
				<view class="member-main-mony_com member-main-mony-left">
					<view class="member-main-mony-left-title"><text>消费金额</text></view>
					<view class="member-main-mony-left-mm"><text>{{userInfo.total}}</text>元</view>
				</view>
				<view class="member-main-mony_com">
					<view class="member-main-mony-left-title"><text>升到下一级需</text></view>
					<view class="member-main-mony-left-mm"><text>{{userInfo.upgradeRequired}}</text>元</view>
				</view>
			</view>
		</view>

		<view class="headleBox-main-title">
			<image class="headleBox-main-title-icon" src="../../static/img/decorate-left.png" mode=""></image>
			<view class="headleBox-main-title-txt">会员权益</view>
			<image class="headleBox-main-title-icon" src="../../static/img/decorate-right.png" mode=""></image>
		</view>

		<view class="member-word">
			<text>	1、一级会员享受长期线下会展一年两张的门票 
					2、二级会员享受线下一年五张门票以及限定空投数字藏品兑换权益
					3、三级会员享受平台生日祝福，一年十张线下门票体验，以及特殊空投兑换数字藏品权益</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle:'会员中心',
				userInfo:{
					level:'',
					total:'',
					upgradeRequired:'',
				}
				
			};
		},
		onLoad() {
			if (uni.getStorageSync('userInfo')) {
				this.userInfo = uni.getStorageSync('userInfo');
				
			} else {
				if (uni.getStorageSync('token')) {
					this.getUserInfo()
				} else {
					this.checkLogin(`/pages/member/member`)
				}
			}
			
		},
		methods:{
			getUserInfo() {
				this.$api.getUserInfo().then(res => {
					console.log(res)
					if (res.code == 200) {
						this.userInfo = res.data;
						uni.setStorageSync('userInfo',res.data)
					} else {
						this.checkLogin(`/pages/member/member`)
					}
				})
			},
		}
	}
</script>

<style lang="less">
	.member{
		width: 100%;
		min-height: 100vh;
		background: #16181D;
		display: flow-root;
	}
	.member-main{
		width: 686rpx;
		height: 278rpx;
		margin: 0 auto;
		margin-top: 20rpx;
		background-color: #262A34;
		background-image: url(@/static/img/member-bg.png);
		background-size:686rpx 278rpx;
		background-repeat: no-repeat;
		border-radius: 20px;
		padding-top: 44rpx;
		.member-main-grade{
			margin-left: 66rpx;
			position: relative;
			width: 400rpx;
			height: 70rpx;
			padding-left: 34rpx;
			padding-top: 14rpx;
			.member-main-grade-img{
				width: 70rpx;
				height: 70rpx;
				position: absolute;
				left: 0;
				bottom: 0;
			}
			.member-main-grade-txt{
				width: 134rpx;
				padding-left: 38rpx;
				height: 44rpx;
				line-height: 44rpx;
				background: rgba(233,243,254,0.17);
				color: #FFFFFF;
				border-radius: 0px 10px 10px 0px;
				font-size: 24rpx;
				letter-spacing: 1px;
				font-family: PingFangSC-Semibold, PingFang SC, '微软雅黑';
				// font-weight: 600;
			}
		}
		.member-main-mony{
			width: 100%;
			display: flex;
			justify-content: space-around;
			.member-main-mony_com{
				text-align: center;
				width: 342rpx;
				margin-top: 30rpx;
				color: #FFFFFF;
				.member-main-mony-left-title{
					height: 40rpx;
					line-height: 40rpx;
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #5D5F7A;
				}
				.member-main-mony-left-mm{
					height: 56rpx;
					font-size: 32rpx;
					font-family: PingFangSC-Medium, PingFang SC,"微软雅黑";
					font-weight: 500;
					color: #FFFFFF;
					line-height: 56rpx;
				}
			}
		}
	}
	
		// 添加背景分割线
		.member-main-mony-left{
			background-image: url(@/static/img/division-icon.png);
			background-repeat: no-repeat;
			background-position: right center; 
		}

	.headleBox-main-title{
		margin-top: 80rpx;
		margin-bottom: 46rpx;
		width: 100%;
		height: 50rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		.headleBox-main-title-icon{
			width: 40rpx;
			height: 40rpx;
		}
		.headleBox-main-title-txt{
			margin: 0 44rpx;
			width: 144rpx;
			height: 50rpx;
			line-height: 50rpx;
			font-size: 36rpx;
			font-weight: 500;
			color: #FFFFFF;
			font-family: PingFangSC-Medium, PingFang SC, '微软雅黑';
		}
	}
	
	.member-word{
		width: 584rpx;
		height: 270rpx;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC,'微软雅黑';
		font-weight: 400;
		color: #5D5F7A;
		line-height: 54rpx;
		margin: 0 auto;
	}
</style>
